package asia.lxq.cic.entity;

import asia.lxq.cic.dao.UserMapper;
import asia.lxq.cic.util.SystemUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Appeal {
    @TableId(value = "appeal_id", type = IdType.AUTO)
    int appealId;
    int appealUserId;
    int appealObjId;
    int appealBelongId;
    String appealType;
    String appealContent;
    String appealStatus;
    String appealReceipt;
    Date appealDate;
    Date appealCompletedDate;
    @TableField(exist = false)
    User appealUser;
    @TableField(exist = false)
    String appealDateFormatted;
    @TableField(exist = false)
    String appealCompletedDateFormatted;
    @TableField(exist = false)
    String appealObjName;

    public void query(UserMapper userMapper) {
        appealUser = userMapper.selectById(appealUserId);
        appealDateFormatted = SystemUtil.simpleDateFormat(appealDate);
        appealCompletedDateFormatted = SystemUtil.simpleDateFormat(appealCompletedDate);
    }
}
